package com.allo2o.common.mapper;

import com.allo2o.common.VO.MerchantBillVO;
import com.allo2o.common.domain.MerchantBillDO;
import com.allo2o.shared.web.result.Paging;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Repository
public interface MerchantBillDOMapper {

    int deleteByPrimaryKey(String billId);

    int insert(MerchantBillDO record);

    int insertSelective(MerchantBillDO record);

    MerchantBillDO selectByPrimaryKey(String billId);

    int updateByPrimaryKeySelective(MerchantBillDO record);

    int updateByPrimaryKey(MerchantBillDO record);

    int countFailedByMobile(@Param("start") String start, @Param("end") String end, @Param("mobile") String mobile, @Param("page") Paging paging);

    List<MerchantBillDO> selectByAccount(@Param("start") String start, @Param("end") String end,
            @Param("mobile") String mobile, @Param("page") Paging paging);

    List<Date> selectByDate(@Param("mobile") String mobile, @Param("page") Paging paging);

    List<Map<Object, Object>> selectAmountByDay(@Param("mobile") String mobile, @Param("list") List list);

    List<Map<Object, Object>> selectBillsDaily(@Param("interval") String interval, @Param("start") String startGmt,
            @Param("end") String endGmt, @Param("mobile") String mobile, @Param("page") Paging paging);

    int countBillsByDaily(@Param("interval") String interval, @Param("start") String startGmt,
            @Param("end") String endGmt, @Param("mobile") String mobile);

    BigDecimal selectSumAmountByMobileAndReconciliation(String mobile);

    int updateStatusByOrderId(@Param("orderId") String orderId, @Param("success") String success,
            @Param("subBillId") String subBillId);

    MerchantBillDO selectByOrderId(String orderId);

    List<MerchantBillDO> queryListBySelective(@Param("merchantBillVO") MerchantBillVO merchantBillVO,
            @Param("paging") Paging page);

    List<Map<Object, Object>> querySettlementList(@Param("merchantBillVO") MerchantBillVO merchantBillVO,
            @Param("paging") Paging page);

    List<Map<Object, Object>> query_merchan_settlement_list(@Param("merchantBillVO") MerchantBillVO merchantBillVO,
            @Param("paging") Paging page);
}